Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Let admins see post thread even when the author blocks them #1678

Merged
merged 3 commits into from
Oct 3, 2023

Conversation

foysalit
Copy link
Contributor

No description provided.

@foysalit foysalit requested review from dholms and devinivy September 26, 2023 20:15
@@ -22,25 +22,41 @@ import {
getRepoRev,
handleReadAfterWrite,
} from '../util/read-after-write'
import { authPassthru } from '../../../../../api/com/atproto/admin/util'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed a build error that might be related to this—is it possible there's one too many ../?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm.. no idea how this happened though since it was auto-imported by vscode lol.

Comment on lines 55 to 59
// TODO: is this right? checking for requester and error type is safe enough?
if (
err instanceof AppBskyFeedGetPostThread.NotFoundError &&
requester
) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I believe that should be fine 👍 Maybe there's a way to split the two cases-up more rather than have the requester checks sprinkled throughout. For example, maybe the case could be offloaded up front since it's relatively simple on its own:

      const requester =
        auth.credentials.type === 'access' ? auth.credentials.did : null

      if (!requester) {
        const res = await ctx.appviewAgent.api.app.bsky.feed.getPostThread(
          params,
          authPassthru(req),
        )
        return {
          encoding: 'application/json',
          body: res.data,
        }
      }

      // ...
      // rest of code continues as originally written
      // ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yes, looks much better. just wasn't sure if the whole handleReadAfterWrite is needed for mods too so didn't spend any time thinking about the implementation. cleaned it up as suggested, thanks!

@foysalit foysalit requested a review from devinivy September 28, 2023 18:13
Copy link
Collaborator

@devinivy devinivy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@devinivy devinivy merged commit 647ca6a into main Oct 3, 2023
@devinivy devinivy deleted the handle-admin-access-to-post-thread branch October 3, 2023 15:01
mloar pushed a commit to mloar/atproto that referenced this pull request Nov 15, 2023
…y-social#1678)

* ✨ Let admins see post thread even when the author blocks them

* ♻️ Refactor requester check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants